﻿using System;
using System.Collections.Generic;
using System.Text;

namespace danalyser.Controllers
{
    // Формы и диалоги
    using danalyser.Interface.Forms;
    using danalyser.Interface.Dialogs;

    /// <summary>
    /// Контроллер форм
    /// </summary>
    public class FormController
    {
        // Одиночка
        private static FormController instance;

        // Формы
        private mainForm main;
        private editorForm editor;
        private aboutForm about;
        private splashForm splash;

        // Диалоги
        private MainSettingsForm mainsettings;
        private AnalysersSettingsForm analyserssettings;
        private SearchForm search;
        private OpenWithForm openwith;

        /// <summary>
        /// Единственный экземпляр контроллера
        /// </summary>
        public static FormController Instance
        {
            get
            {
                if (instance == null)
                    instance = new FormController();
                return instance;
            }
        }

        /// <summary>
        /// Главное окно
        /// </summary>
        public mainForm Main
        {
            get
            {
                if (main == null)
                    main = new mainForm();
                return main;
            }
        }

        /// <summary>
        /// Окно редактора кода
        /// </summary>
        public editorForm Editor
        {
            get
            {
                if (editor == null)
                    editor = new editorForm();
                return editor;
            }
        }

        /// <summary>
        /// Окно "О программе"
        /// </summary>
        public aboutForm About
        {
            get
            {
                if (about == null)
                    about = new aboutForm();
                return about;
            }
        }

        /// <summary>
        /// Окно "Ожидание"
        /// </summary>
        public splashForm Splash
        {
            get
            {
                if (splash == null)
                    splash = new splashForm();
                return splash;
            }
        }

        /// <summary>
        /// Окно настроек анализатора
        /// </summary>
        public MainSettingsForm MainSettings
        {
            get
            {
                if (mainsettings == null)
                    mainsettings = new MainSettingsForm();
                return mainsettings;
            }
        }

        /// <summary>
        /// Окно настроек статических анализаторов
        /// </summary>
        public AnalysersSettingsForm AnalyserSettings
        {
            get
            {
                if (analyserssettings == null)
                    analyserssettings = new AnalysersSettingsForm();
                return analyserssettings;
            }
        }

        /// <summary>
        /// Окно поиска в редакторе кода
        /// </summary>
        public SearchForm Search
        {
            get
            {
                if (search == null)
                    search = new SearchForm();
                return search;
            }
        }

        /// <summary>
        /// Окно "открыть с помощью"
        /// </summary>
        public OpenWithForm OpenWith
        {
            get
            {
                if (openwith == null)
                    openwith = new OpenWithForm();
                return openwith;
            }
        }
    }
}
